#ifndef OPUS_ENCODER_H
#define OPUS_ENCODER_H

#include <opus/opus.h>
#include <cstdio>
#include <cstdlib>

class OpusEncode :public EncodeBase {
public:
    OpusEncode(int sampleRate, int channels, int bitrate, AudioEncDataObserver* p=nullptr);
    ~OpusEncode();

    virtual void encode(void* data, size_t dataSize, long long pts)override;
private:
    OpusEncoder* encoder_;
    int sampleRate_;
    int channels_;
    int bitrate_;
    std::unique_ptr<char[]> packet_buffer_ = nullptr;
    int packet_len_ = 0;
    AudioEncDataObserver* ob_;
};

#endif // OPUS_ENCODER_H
